package com.dc.datacollect.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dc.datacollect.entity.CollectGroup;
import com.dc.datacollect.mapper.CollectGroupMapper;
import com.dc.datacollect.service.CollectGroupService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
* @author zhuangjie
* @description 针对表【collect_group(关联)】的数据库操作Service实现
* @createDate 2023-06-19 14:50:58
*/
@Service
public class CollectGroupServiceImpl extends ServiceImpl<CollectGroupMapper, CollectGroup>
    implements CollectGroupService {

    @Override
    public List<Long> getGroupByCollectId(Long collectId) {
        LambdaQueryWrapper<CollectGroup> collectGroupQueryWrapper = new LambdaQueryWrapper<>();
        collectGroupQueryWrapper.eq(CollectGroup::getCollectId,collectId);
        List<CollectGroup> collectGroupList = this.list(collectGroupQueryWrapper);
        List<Long> groupIds = collectGroupList.stream().map(collectGroup -> collectGroup.getGroupId()).collect(Collectors.toList());
        return groupIds;
    }
}




